package com.gxuwz.cyhschool;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;

public class change extends AppCompatActivity implements View.OnClickListener {

    private Button xgmm_btn;
    private EditText new_psd;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_change);

        getSupportActionBar().hide();

        xgmm_btn=findViewById(R.id.btn_change);
        new_psd=findViewById(R.id.ed_password1);

        xgmm_btn.setOnClickListener(this);

        ImageView imageView=findViewById(R.id.iv_return);
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });



    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.iv_return:
                finish();
                break;
            case R.id.btn_change:
                String newPsd = new_psd.getText().toString();
                if(newPsd==null || newPsd.equals("")) {
                    Toast.makeText(change.this, "请输入新密码", Toast.LENGTH_SHORT).show();
                }else{
                    Toast.makeText(change.this,"修改成功",Toast.LENGTH_SHORT).show();
                    Intent intent = new Intent();
                    intent.setClass(change.this,login.class);
                    startActivity(intent);
                }
        }
    }



}